﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;

public class tbProposalDB
{
    #region[tbProposal_Add]
    public static bool tbProposal_Add(tbProposalDATA _tbProposalDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_Add", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", _tbProposalDATA.uSend));
                dbCmd.Parameters.Add(new SqlParameter("@uRec", _tbProposalDATA.uRec));
                dbCmd.Parameters.Add(new SqlParameter("@prName", _tbProposalDATA.prName));
                dbCmd.Parameters.Add(new SqlParameter("@prContent", _tbProposalDATA.prContent));
                dbCmd.Parameters.Add(new SqlParameter("@prFiles", _tbProposalDATA.prFiles));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbProposal_Update_New]
    public static bool tbProposal_Update_New(tbProposalDATA _tbProposalDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_Update_New", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@prID", _tbProposalDATA.prID));
                dbCmd.Parameters.Add(new SqlParameter("@prContent", _tbProposalDATA.prContent));
                dbCmd.Parameters.Add(new SqlParameter("@prFiles", _tbProposalDATA.prFiles));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbProposal_Update]
    public static bool tbProposal_Update(tbProposalDATA _tbProposalDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_Update", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@prID", _tbProposalDATA.prID));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbProposal_Delete]
    public static bool tbProposal_Delete(string prID)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_Delete", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@prID", prID));
                dbConn.Open();
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbProposal_GetByAll]
    public static List<tbProposalDATA> tbProposal_GetByAll()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByAll", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByID]
    public static List<tbProposalDATA> tbProposal_GetByID(string prID)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@prID", prID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend]
    public static List<tbProposalDATA> tbProposal_GetByuSend(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Asc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Name_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Name_Asc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Name_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Name_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Name_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Name_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Name_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Name_Desc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Name_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Name_Desc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Name_Desc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Name_Desc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Status_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Status_Asc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Status_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Status_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Status_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Status_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Status_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Status_Desc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Status_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Status_Desc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Status_Desc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Status_Desc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Nguoinhan_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Nguoinhan_Asc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Nguoinhan_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Nguoinhan_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Nguoinhan_Desc(string uSend)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Nguoinhan_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uSend", uSend));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Nguoinhan_Desc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Nguoinhan_Desc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Nguoinhan_Desc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec]
    public static List<tbProposalDATA> tbProposal_GetByuRec(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByAdmin]
    public static List<tbProposalDATA> tbProposal_GetByAdmin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByAdmin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Asc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByAdmin_Asc]
    public static List<tbProposalDATA> tbProposal_GetByAdmin_Asc()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByAdmin_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Name_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Name_Asc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Name_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Name_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Name_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Name_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Name_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Name_Desc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Name_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Name_Desc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Name_Desc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Name_Desc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Status_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Status_Asc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Status_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Status_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Status_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Status_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Status_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Status_Desc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Status_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Status_Desc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Status_Desc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Status_Desc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Nguoigui_Asc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Nguoigui_Asc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Nguoigui_Asc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuSend_Nguoinhan_Asc_Admin]
    public static List<tbProposalDATA> tbProposal_GetByuSend_Nguoinhan_Asc_Admin()
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuSend_Nguoinhan_Asc_Admin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                        reader["prID"].ToString(),
                        reader["uSend"].ToString(),
                        reader["uRec"].ToString(),
                        reader["prName"].ToString(),
                        reader["prContent"].ToString(),
                        reader["prFiles"].ToString(),
                        reader["prSendDate"].ToString(),
                        reader["prBrowseDate"].ToString(),
                        reader["prStatus"].ToString(),
                        reader["Nguoigui"].ToString(),
                        reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbProposal_GetByuRec_Nguoigui_Desc]
    public static List<tbProposalDATA> tbProposal_GetByuRec_Nguoigui_Desc(string uRec)
    {
        List<tbProposalDATA> list = new List<tbProposalDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbProposal_GetByuRec_Nguoigui_Desc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uRec", uRec));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbProposalDATA objtbProposalDATA = new tbProposalDATA(
                         reader["prID"].ToString(),
                         reader["uSend"].ToString(),
                         reader["uRec"].ToString(),
                         reader["prName"].ToString(),
                         reader["prContent"].ToString(),
                         reader["prFiles"].ToString(),
                         reader["prSendDate"].ToString(),
                         reader["prBrowseDate"].ToString(),
                         reader["prStatus"].ToString(),
                         reader["Nguoigui"].ToString(),
                         reader["Nguoinhan"].ToString());
                        list.Add(objtbProposalDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
}
